package com.xcdh.commons.utils;


import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

public class IFUtils {
    public static <T> T nvl(T target , T spare){
        return Objects.isNull(target) ? spare : target ;
    }
    public static String nvlString(String target , String spare){
        return StringUtils.isBlank(target) ? spare : target ;
    }
    public static <T> T ifElse(boolean state , T target , T spare){
        return  state ? target : spare ;
    }

    public static <T> T eqElse(T t1 , T t2 , T target , T spare){
        return  t1==t2 ? target : spare ;
    }
}
